package prv.ljw.boot.dao;

import org.springframework.cache.annotation.CacheConfig;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import prv.ljw.boot.domain.TDemo;

/**
 * Created by carry on 2017/2/27.
 */
@CacheConfig(cacheNames = "tdemo")
public interface TDemoRespository extends JpaRepository<TDemo,Integer> {

    @Cacheable
    TDemo findByName(String name);

    TDemo findByNameAndAge(String name,Integer age);

    @Query(value = "from TDemo td where td.name = :name")
    TDemo findUser(@Param("name") String name);

}
